using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration; 
using SalesPages.DomainModel;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class E1ConfigMap : EntityTypeConfiguration<E1Config>
    {
        public E1ConfigMap()
        {
            // Primary Key
            this.HasKey(t => t.ConfigId);

            // Properties
            this.Property(t => t.ConfigName)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.ConfigValue)
                .IsRequired()
                .HasMaxLength(1024);

            this.Property(t => t.Country)
                .IsRequired()
                .HasMaxLength(5);

            // Table & Column Mappings
            this.ToTable("E1Config");
            this.Property(t => t.ConfigId).HasColumnName("ConfigId");
            this.Property(t => t.ConfigName).HasColumnName("ConfigName");
            this.Property(t => t.ConfigValue).HasColumnName("ConfigValue");
            this.Property(t => t.Country).HasColumnName("Country");
            this.Property(t => t.InsertDate).HasColumnName("InsertDate");
            this.Property(t => t.UpdateDate).HasColumnName("UpdateDate");
        }
    }
}
